<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:85:"/www/wwwroot/jiedai.bianshenn.top/public/../application/admin/view/save/save_pwd.html";i:1552551059;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/admin.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/pintuer.js"></script>
    <script src="../js/pintuer.js"></script>
    <script src="../layer/layer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span> 修改管理员密码</strong></div>
    <div class="body-content">
        <div  class="form-x" >
            <div class="form-group">
                <div class="label">
                    <label for="sitename">管理员帐号：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50"  value="<?php echo \think\Session::get('user.name'); ?>" disabled name="username" size="50"   />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">原始密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50"  id="orpassword" name="orpassword" size="50" placeholder="请输入原始密码" data-validate="required:请输入原始密码" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" id="password" name="password" size="50" placeholder="请输入新密码" data-validate="required:请输入新密码,length#>=5:新密码不能小于5位" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">确认新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" id="repassword" name="repassword" size="50" placeholder="请再次输入新密码" data-validate="required:请再次输入新密码,repeat#password:两次输入的密码不一致" />
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" onclick="pwdupdata()"> 提交</button>
                </div>
            </div>
        </div>
    </div>
    <div>
</div>
<script>
    function pwdupdata() {
        var password = $(" input[ name='password' ] ").val();
        var repassword = $(" input[ name='repassword' ] ").val();
        var orpassword = $(" input[ name='orpassword' ] ").val();
        if(password == ""){
            alert('新密码不能为空');
            return false;
        }
        if(repassword == ""){
            alert('确认新密码不能为空');
            return false;
        }
        if(!password == repassword){
            alert('两次输入密码不一致');
            return false;
        }
        $.ajax({
            url: "save_pwdupdata",
            type: "POST",
            data: {"orpassword":orpassword,"password":password,"repassword":repassword},
            dataType: "json",
            //success 会在成功接收到返回数据后触发
            success:function (re) {
                if(re.code == 1){
                    layer.alert('原密码不正确');
                }
                if(re.code == 2){
                    layer.alert('修改成功');
                }
                if(re.code == 3){
                    layer.alert('修改失败');
                }
            }
        });
    }
</script>
</body></html>